1
2
3
4 package joeq.Compiler.Quad;
5
6 import joeq.Compiler.Quad.Operand.RegisterOperand;
7 import joeq.Interpreter.QuadInterpreter;
8 import joeq.Main.jq;
9 import joeq.Runtime.Unsafe;
10
11
12
13
14
15 class Delegates {
16 static class Op implements Operator.Delegate {
17 public void interpretGetThreadBlock(Operator.Special op, Quad q, QuadInterpreter s) {
18 if (jq.RunningNative)
19 s.putReg_A(((RegisterOperand)Operator.Special.getOp1(q)).getRegister(), Unsafe.getThreadBlock());
20 }
21 public void interpretSetThreadBlock(Operator.Special op, Quad q, QuadInterpreter s) {
22 joeq.Scheduler.jq_Thread o = (joeq.Scheduler.jq_Thread)Operator.getObjectOpValue(Operator.Special.getOp2(q), s);
23 if (jq.RunningNative)
24 Unsafe.setThreadBlock(o);
25 }
26 public void interpretMonitorEnter(Operator.Monitor op, Quad q, QuadInterpreter s) {
27 Object o = Operator.getObjectOpValue(Operator.Monitor.getSrc(q), s);
28 if (jq.RunningNative)
29 joeq.Runtime.Monitor.monitorenter(o);
30 }
31 public void interpretMonitorExit(Operator.Monitor op, Quad q, QuadInterpreter s) {
32 Object o = Operator.getObjectOpValue(Operator.Monitor.getSrc(q), s);
33 if (jq.RunningNative)
34 joeq.Runtime.Monitor.monitorexit(o);
35 }
36 }
37 }